﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileTransfer.Model
{
    /// <summary>
    /// FTP线程实时状态
    /// </summary>
    public class FtpThreadStatu
    {
        /// <summary>
        /// 线程编号
        /// </summary>
        public string ThreadId { get; set; }
        /// <summary>
        /// 文件大小（数字）
        /// </summary>
        public long Size { get; set; }
        /// <summary>
        /// 文件大小（字符）
        /// </summary>
        public string Length
        {
            get
            {
                return Size > 1024 * 1024 ? string.Format("{0}MB", Math.Round((double)Size / (1024 * 1024), 2)) : string.Format("{0}KB", Math.Round((double)Size / 1024, 2));
            }
        }
        /// <summary>
        /// 已读取大小
        /// </summary>
        public long ReadSize { get; set; }
        /// <summary>
        /// 已写入大小
        /// </summary>
        public long WriteSize { get; set; }
        /// <summary>
        /// 下载速度
        /// </summary>
        public long DownRate { get; set; }
        public string DownRateStr
        {
            get
            {
                return DownRate > 1024 * 1024 ? string.Format("{0}MB/s", Math.Round((double)DownRate / (1024 * 1024), 2)) : string.Format("{0}KB/s", Math.Round((double)DownRate / 1024, 2));
            }
        }

        /// <summary>
        /// 最大下载速度
        /// </summary>
        public long MaxRate { get; set; }
        /// <summary>
        /// 最下下载速度
        /// </summary>
        public long MinRate { get; set; }
    }
}
